/**
 * @description
 * @author ynshun
 * @sincere 2016年1月24日 下午10:16:01
 * @version 1.0
 */
package com.tiantian.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tiantian.dao.TaskProductInformationRepostory;
import com.tiantian.datajpa.service.impl.GenericServiceImpl;
import com.tiantian.domain.Taskproductinformation;
import com.tiantian.service.TaskproductinformationService;

/**
 * 
 * @description
 * @author ynshun
 * @sincere 2016年1月24日 下午10:16:01
 * @version 1.0
 */
@Service
public class TaskproductinformationServiceImpl extends GenericServiceImpl<Taskproductinformation, String> implements TaskproductinformationService {
	private TaskProductInformationRepostory repository;

	@Autowired
	public void setRepository(TaskProductInformationRepostory repository) {
		super.setGenericDAO(repository);
		this.repository = repository;
	}

	public List<Taskproductinformation> findMajorByTaskId(String taskId) {
		String sql = "select * from taskproductinformation t where t.taskId=:taskId and t.majorProductsMark=1";
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("taskId", taskId);
		return repository.queryListBySql(sql, params, Taskproductinformation.class);
	}

	public List<Taskproductinformation> findMajorNotMainByTaskId(String taskId) {
		String sql = "select * from taskproductinformation t where t.taskId=:taskId and t.majorProductsMark=2";
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("taskId", taskId);
		return repository.queryListBySql(sql, params, Taskproductinformation.class);
	}

}
